package com.tedu.api;
/**
 * - [ ] 1.输出字符串"HelloJava"的字符串长度                               √
 * - [ ] 2.输出"HelloJava"中o的位置                                      √
 * - [ ] 3.输出"HelloJava"中下标为5处开始第一次出现以"o"的位置                √
 * - [ ] 4.截取"HelloJava"中"Hello"并输出                                √
 * - [ ] 5.截取"HelloJava"中"Java"并输出                                 √
 * - [ ] 6.将字符串" Hello "中两边的空白去掉后输出                           √
 * - [ ] 7.输出"HelloJava"中第6个字符"J"                                  √
 * - [ ] 8.将"HelloJava"转换为小写，然后转换为大写                           √
 */

import org.junit.Test;

import java.util.Locale;

public class 作业 {
    @Test
    public void testSubString() {
        String url = "www.Hello java.com";
        //4. url=url.substring(4,9);
        System.out.println("截取字符串：" + url);
        //5.url=url.substring(10,14);
        System.out.println("截取字符串：" + url);
    }

    @Test
    public void testIndexOf() {
        //2.
        String str = "Hello java";
        int index = str.indexOf("o");
        System.out.println("打印下标位：" + index);
        //3.
        String url = "Hello java";
        index = url.lastIndexOf("o");
        System.out.println("最后的下标位：" + index);
        //7
        index = str.lastIndexOf("j");
        System.out.println("最后的下标位：" + index);


    }

    @Test
    public void testLength() {
        //1.
        String str = "Hello java";
        System.out.println(str.length());


    }

    @Test
    //8.
    public void testTrim1() {
        String str = "HelloJava";
        str = str.trim().toLowerCase();
        System.out.println("小写" + str);
        str = str.toUpperCase();
        System.out.println("大写" + str);
    }

    @Test
    //6
    public void testTrim() {
        String str = " Hello ";
        str = str.trim();
        System.out.println("去掉空格:" + str);

    }
}